import createAxios from '../utils/axios'

// 获取主体商品详情
export const getDetail = (id: number) => {
    return createAxios({
        url: `/shop/goods/detail?id=${id}`,
        method: 'GET',
    });
}
//加入购物车
export const addCarts = (params: any) => {
    return createAxios({
        url: '/shop/userCart/add',
        method: 'POST',
        data: params,
    });
}
//删除购物车商品
export const deleteCarts = (params: any) => {
    return createAxios({
        url: '/shop/userCart/delete',
        method: 'POST',
        data: params,
    });
}
//删除购物车全部商品
export const clearCarts = (params: any) => {
    return createAxios({
        url: '/shop/userCart/clear',
        method: 'POST',
        data: params,
    });
}
//获取购物车
export const getCarts = () => {
    return createAxios({
        url: '/shop/userCart?page=1&page_size=50',
        method: 'GET',
    });
}
//评价列表
export const getEvaluatelist = (id: number, page: number, pagesize: number) => {
    return createAxios({
        url: `/shop/orderEvaluate/list?goods_id=${id}&page=${page}&page_size=${pagesize}`,
        method: 'GET',
    });
}
//点赞
export const likeReview = (params: any) => {
    return createAxios({
        url: '/api/order/evaluate/comment/like',
        method: 'POST',
        data: params,
    });
}
//访问量
export const addVisit = (params: any) => {
    return createAxios({
        url: '/shop/goods/addVisit',
        method: 'POST',
        data: params,
    });
}
// 收藏列表
export const getFavoriteList = () => {
    return createAxios({
        url: '/shop/user_favorite/list?page=1&page_size=200',
        method: 'GET',
    });
}
// 添加收藏
export const addFavorite = (params: any) => {
    return createAxios({
        url: '/shop/user_favorite/add',
        method: 'POST',
        data: params,
    });
}
// 取消收藏
export const delFavorite = (params:any) => {
    return createAxios({
        url: '/shop/user_favorite/delete',
        method: 'POST',
        data: params,
    });
}
